﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using JustinAngel.Neurons.Framework;
using JustinAngel.Neurons.Framework.Helpers;
using Ninject;

namespace JustinAngel.Neurons
{
    public class IAppNetworkChecker : IAppService
    {
        [Inject]
        public INetworkStatusProvider NetworkStatusProvider { get; set; }

        [Inject]
        public IDialogService DialogService { get; set; }

        public void StartService()
        {
            //if (!NetworkStatusProvider.IsConnected)
            //{
            //    DialogService.ShowMessageBox("You are not connected via 3G or WiFi. Please open the app back up again when you're back online.",
            //                 "DON'T PANIC!",
            //                 MessageBoxButton.OK);
            //    throw new ApplicationExitException();
            //}
            if (NetworkStatusProvider.IsConnectedToZune)
            {
                DispatcherHelper.BeginInvokeOnUIThreadAtEndOfQueue(() =>
                {
                    DialogService.ShowMessageBox("Windows Phone 7 cannot play videos or radio while connected to a computer running Zune. Either disconnect your Windows Phone 7 from your computer, or close down Zune. Then open this app back up again.",
                    "Close down Zune!",
                    MessageBoxButton.OK);
                    throw new ApplicationExitException();
                });  
            }
        }


        public void StopService()
        {
        }
    }
}
